﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using He.Common;

namespace He.Web.manage.feedback
{
    public partial class edit : He.Web.UI.Manage
    {
        protected Model.feedback model;
        public int id;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!int.TryParse(Request.Params["id"] as string, out this.id))
            {
                JscriptMsg(350, 230, "错误提示", "<b>出现错误啦！</b>您要修改的信息不存在或参数不正确。", "back", "Error");
                return;
            }
            if (!IsPostBack)
            {
                model = new He.BLL.feedback().GetModel(id);
                txtReContent.Text = model.re_content;
                chkLoginLevel("edit" + model.pos_mark);
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            model = new BLL.feedback().GetModel(id);
            model.re_content = base.ToHtml(txtReContent.Text);
            model.re_time = DateTime.Now.ToString();
            if (new BLL.feedback().Update(model))
            {
                string url = CookieHelper.Get("LastListUrl");
                if (string.IsNullOrEmpty(url))
                {
                    url = Request.RawUrl;
                }
                SaveLogs(string.Format("[留言板管理]回复留言:{0}", model.title));
                JscriptPrint("留言回复成功啦！", url, "Success");
            }
        }
    }
}
